home *** CD-ROM | disk | FTP | other *** search
/ Floppyshop 2 / Floppyshop - 2.zip / Floppyshop - 2.iso / art&graf.ix / art-3488 / macros / demosch.aim < prev    next >
Text File  |  1990-10-13  |  4KB  |  133 lines

  1. * Analysis of electronic scheme 
  2. * by Cellular Logic Operations 
  3. * Frans Groen
  4. *
  5. readf scheme,A
  6. @_corshad   * correct the image for shading
  7. * obtain from the corrected image
  8. * a binary image by thresholding
  9. thresh B,B,1,220    * threshold
  10. toff
  11. doff        * display off
  12. bcop 1,8    * copy the thresholded image
  13. bcop 1,6    * original in green
  14. inv 6       * after inversion
  15. *
  16. * separation of drawing and text
  17. *
  18. *
  19. * fill small holes
  20. bcop 8,7,b,b       * copy bitplane
  21. don
  22. erosion 1,8,4,0,b  * erode small holes away
  23. prop 511,8,7,8,0,b * propagate for what remains
  24. inv 8              * cleaned drawing in red
  25. don,4              * multi-bitplane display on
  26. bcopy 8,5,b,b      * save original in b5
  27. doff               * display off
  28. *
  29. * make skeleton
  30. skelet 511,8,1,b   * skeleton in b8
  31. don                * single bitplane display
  32. bcopy 8,4          * save skeleton in b4
  33. *
  34. * shave skeleton
  35. bcopy 8,7,b,b       * copy in b7
  36. -skelet 16,7,1,b    * remove strokes of length 16
  37. exor 8,7,7,b        * find strokes
  38. vertices 8,0,b      * vertices in bitplane 3
  39. dilation 1,8,8,0,b  * enlarge vertices
  40. propag 511,8,7,8,0,b * propagate vertices in strokes
  41. exor 4,8,8,b        * cleaned object in b8
  42. bcopy 8,4           * save in b4
  43. *
  44. * separate text based upon vertices in 
  45. * the skeleton with removed strokes
  46. bcopy 8,7            * copy for propagation mask
  47. vertices 8,0,b       * find vertices
  48. propag 511,8,7,8,0,b * propagate vertices in skeleton
  49. bcop 8,4,b,b         * save cleaned skeleton in b4
  50. propag 511,8,5,8,0,b * propagate skeleton in drawing
  51. doff                 * display off
  52. reset 7              * reset for display
  53. don,4                * multi-bitplane display 
  54. bcop 8,5             * save original in b5
  55. *doff                 * display off 
  56. *
  57. *analyse objects
  58. *capacitors : big objects
  59. bcop 5,6            * original in b8
  60. ero 4,6,4           * find capacitors
  61. prop 4,6,5,8,0,b    * propagate back
  62. *  capacitors in b6
  63. *resistors : objects enclosing small holes
  64. don,4
  65. inv 5,b             * invert
  66. bcop 5,7            * original in b7
  67. ero 5,7             * erode 5 times
  68. propag 511,7,5,8,0,b * find what remains
  69. exor 5,7,7,b        * find what disappears
  70. *  resistors in b7
  71. * opamps
  72. bcop 5,8
  73. erosion 7,8,8,0,b   * erode 7 times
  74. propag 511,8,5,8,0,b * find what remains
  75. exor 5,8,8,b        * and what disappears
  76. exor 7,8,8,b        * removes the resistors
  77. doff
  78. *  opamps in b8
  79. * finds location of components in scheme
  80. *   extend opamps
  81. dilation 2,8,6,0,b * extend opamps  
  82. bcopy 8,1,b,b      * save seed bitplane
  83. propag 3,8,4,6,0,b * propagate in skeleton
  84. or 1,8,8,b         * or seed bitplane
  85. bcopy 8,1,b,b      * opamps in b1
  86. * extend resistors
  87. dilation 2,7,6,0,b * extend resistors
  88. bcopy 7,2,b,b      * save seed bitplane
  89. propag 3,7,4,6,0,b * propagate in skeleton
  90. or 2,7,7,b         * or seed bitplane
  91. bcopy 7,2,b,b      * resistors in b2
  92. * extend capacitors
  93. bcopy 6,3,b,b      * save seed bitplane
  94. propag 3,6,4,6,0,b * propagate capacitors in skeleton
  95. or 3,6,6,b         * or seed bitplane
  96. don,4              * multi-bitplane display on
  97. bcopy 6,3,b,b      * capacitors in b3
  98. * determine endpoints and branchpoints
  99. * find scheme without components
  100. bcop 4,8         * get cleaned drawing (b4)
  101. inv 8            * invert
  102. or 1,8,8         * get rid of opamps
  103. or 2,8,8         * resistors
  104. or 3,8,8         * capacitors
  105. inv 8            * drawing without components
  106. bcopy 8,6        * copy in b6 for vertices
  107. bcopy 8,7        * copy in b7 for endpixels
  108. * find endpixels of the components
  109. endpix 7,0,b     * find endpixels
  110. dilation 2,7,6,0,b * extend endpixels
  111. * find vertices
  112. vertices 6,0,b
  113. dilation 2,6,6,0,b
  114. *
  115. * color assignment
  116. * lines    : grey    resistors  : blue
  117. * endpixels: yellow  capacitors : green
  118. * vertices : purple  opamps     : red
  119. *dilate lines because of low_res display
  120. dilation 1,8,6,0,b
  121. or 6,8,8
  122. or 7,8,8           * lines    : grey   876.....
  123. exor 8,6,6         * vertices : purple 87......
  124. exor 8,7,7         * endpixels: yellow 8.6.....
  125. * insert components
  126. or 1,8,8           * opamps   : red    8......1
  127. or 2,7,7           * resistors: blue   .7....2.
  128. or 3,6,6           * capacitors: green ..6..3.. 
  129. reset 5 b
  130. gdisp b            * grey value display shows color
  131.  
  132.